The arguments arestruct dsreq* dsopen(char *opath, int oflags);
opath | The name of the device special file as a character string, for example "/dev/scsi/jag0d7l0" (see "Form of Names in /dev/scsi"). |
oflags | The oflag value expected by open() when opening this device special file. O_EXCL has special meaning; see "Relationship to Other Device Special Files". |
If the open() call fails or memory cannot be allocated, the function returns NULL. Otherwise it allocates a dsreq structure as well as generous buffers for command and sense strings. The following fields of the dsreq are initialized:
ds_time | Set to 10000 (10 second timeout). |
ds_private | Set to the address of the context that contains the dsreq as well as the command and sense buffers. |
ds_cmdbuf | Set to the address of the command buffer. |
ds_cmdlen | Set to the length of the allocated command buffer. |
ds_sensebuf | Set to the address of the allocated sense buffer. |
ds_senselen | Set to the length of the sense buffer. |
Other fields of the dsreq are cleared to zero.
Note: Other functions in dslib assume that a dsreq has been initialized by dsopen(). In particular they assume the ds_private value points to a context block. You should not attempt to use any dsreq structure with a dslib function except one returned by dsopen(); and you should not use a dsreq opened for one file with another file. The dsclose() function releases the dsreq structure and close the device. Its prototype is
The only argument is the dsreq created by dsopen().void dsclose(struct dsreq *dsp);